import service from '../request'

// 登录
export function postlogin(data) {
  let fromdate = new FormData()

  fromdate.append('username', data.username)
  fromdate.append('password', data.password)

  return service({
    url: '/api/login',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    data: fromdate,
  })
}

// 注册
export function postregister(data) {
  return service({
    url: '/public/register',
    method: 'post',
    data,
  })
}

//忘记密码
export function postforgotpass(data) {
  return service({
    url: '/public/reset',
    method: 'post',
    data,
  })
}

//修改密码
export function postmodifypass(data) {
  return service({
    url: '/public/modify',
    method: 'post',
    data,
  })
}

// 获取用户
export function getusers() {
  return service({
    url: '/public/welcome',
    method: 'get',
  })
}

// 获取用户列表
export function getuserlist(data) {
  return service({
    url: '/system/list',
    method: 'get',
    params: data,
  })
}

// 编辑用户
export function putuser(data) {
  return service({
    url: '/system/update',
    method: 'put',
    data,
  })
}

//删除用户
export function deluser(id) {
  return service({
    url: `/system/${id}`,
    method: 'delete',
  })
}

// 人员类型列表
export function gettype() {
  return service({
    url: '/person/type',
    method: 'get',
  })
}
